import Vue from 'vue'
import Router from 'vue-router'
import jsCookie from 'js-cookie'
Vue.use(Router)


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
// const originalPush = Router.prototype.push
// Router.prototype.push = function push(location) {
//   return originalPush.call(this, location).catch(err => err)
// }
const router = new Router({
  mode: 'hash',
  base: ``,
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('./views/home/login.vue'),
    },
    {
      path: '/',
      name: 'home',
      component: () => import('./views/home/index.vue'),
      children: [{
        path: '/basic/cardBag',
        name: 'cardBag',
        meta: { title: '卡包管理' },
        component: () => import('./views/basicManage/cardBag.vue'),
      },{
        path: '/basic/carousel',
        name: 'carousel',
        meta: { title: '轮播图' },
        component: () => import('./views/basicManage/carousel.vue'),
      },

      {
        path: '/basic/cardVoucher',
        name: 'cardVoucher',
        meta: { title: '卡券管理' },
        component: () => import('./views/basicManage/cardVoucher.vue'),
      },
      {
        path: '/basic/goods',
        name: 'goods',
        meta: { title: '商品管理' },
        component: () => import('./views/basicManage/goods.vue'),
      },
      {
        path: '/basic/goodsClassify',
        name: 'goodsClassify',
        meta: { title: '商品分类管理' },
        component: () => import('./views/basicManage/goodsClassify.vue'),
      },
      {
        path: '/basic/themeList',
        name: 'themeList',
        meta: { title: '主题管理' },
        component: () => import('./views/basicManage/themeList.vue'),
      },
      {
        path: '/basic/deliver',
        name: 'deliver',
        meta: { title: '快递管理' },
        component: () => import('./views/basicManage/deliver.vue'),
      },
      {
        path: '/system/distributor',
        name: 'distributor',
        meta: { title: '经销商管理' },
        component: () => import('./views/systemManage/distributor.vue'),
      },
      {
        path: '/system/account',
        name: 'account',
        meta: { title: '账户管理' },
        component: () => import('./views/systemManage/account.vue'),
      },
      {
        path: '/system/deliverSet',
        name: 'deliverSet',
        meta: { title: '自动发货设置' },
        component: () => import('./views/systemManage/deliverSet.vue'),
      },
      {
        path: '/operations/exchange',
        name: 'exchange',
        meta: { title: '兑换列表' },
        component: () => import('./views/operationsManage/exchange.vue'),
      },
      {
        path: '/operations/invoiceLog',
        name: 'invoiceLog',
        meta: { title: '开票列表' },
        component: () => import('./views/operationsManage/invoiceLog.vue'),
      },

      {
        path: '/member/memberList',
        name: 'memberList',
        meta: { title: '会员列表' },
        component: () => import('./views/memberManage/memberList.vue'),
      },
      {
        path: '/operations/orders',
        name: 'orders',
        meta: { title: '订单列表' },
        component: () => import('./views/operationsManage/orders.vue'),
      },
      {
        path: '/operations/BigUserInfo',
        name: 'BigUserInfo',
        meta: { title: '大件发货' },
        component: () => import('./views/operationsManage/BigUserInfo.vue'),
      },
      {
        path: '/operations/complaint',
        name: 'complaint',
        meta: { title: '物流投诉' },
        component: () => import('./views/operationsManage/complaint.vue'),
      }]
    },
  ],
})
export default router
